package org.testfire.realm.model.entities.testfire;

import java.sql.Timestamp;
import java.util.List;
import javax.persistence.*;

/**
 * Created by IntelliJ IDEA.
 * User: granum
 * Date: Aug 21, 2007
 * Time: 12:20:25 AM
 */
@Entity
@Table(catalog = "testfire", name = "test")
public class TestEntity
{
    private int id;

    private String name;

    private String forbug;

    private Timestamp created;

    private String description;

    private String testdata;

    private List<TagEntity> tags;
	private List<TestResultsEntity> results;

	@OneToMany(mappedBy = "test")
	public List<TestResultsEntity> getResults()
	{
		return results;
	}

	public void setResults(List<TestResultsEntity> results)
	{
		this.results = results;
	}


	@OneToMany
    @JoinTable(catalog = "testfire", name = "test_owns_tags",
        joinColumns = @JoinColumn(name = "test_id", referencedColumnName = "id", nullable = false),
        inverseJoinColumns = @JoinColumn(name = "tag_id", referencedColumnName = "id", nullable = false))
    public List<TagEntity> getTags()
    {
        return tags;
    }

    public void setTags( List<TagEntity> tags )
    {
        this.tags = tags;
    }

    @Basic
    @Column(name = "testData", nullable = false, length = 16277215)
    public String getTestdata()
    {
        return testdata;
    }

    public void setTestdata( String testdata )
    {
        this.testdata = testdata;
    }

    @Basic
    @Column(name = "description", nullable = false, length = 65535)
    public String getDescription()
    {
        return description;
    }

    public void setDescription( String description )
    {
        this.description = description;
    }

    @Basic
    @Column(name = "created", nullable = false, length = 19)
    public Timestamp getCreated()
    {
        return created;
    }

    public void setCreated( Timestamp created )
    {
        this.created = created;
    }

    @Basic
    @Column(name = "forBug", nullable = false)
    public String getForbug()
    {
        return forbug;
    }

    public void setForbug( String forbug )
    {
        this.forbug = forbug;
    }

    @Basic
    @Column(name = "name", nullable = false)
    public String getName()
    {
        return name;
    }

    public void setName( String name )
    {
        this.name = name;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name = "id", nullable = false, length = 10)
    public int getId()
    {
        return id;
    }

    public void setId( int id )
    {
        this.id = id;
    }
}
